export function listHref(id: string | number, page: number, sort: string): string {
	return `/work/list?id=${id}&page=${page}&sort=${sort}`;
}
export function listAs(id: string | number, page: number, sort: string): string {
	return `/work/list/${id}?page=${page}&sort=${sort}`;
}
export function listUrl(id: string | number, page: number, sort: string): string[] {
	return [listHref(id, page, sort), listAs(id, page, sort)];
}

export function userHref(id: number): string {
	return `/user/view?id=${id}`;
}
export function userAs(id: number): string {
	return `/user/${id}`;
}
export function userUrl(id: number): string[] {
	return [userHref(id), userAs(id)];
}

export function workHref(id: number): string {
	return `/work/view?id=${id}`;
}
export function workAs(id: number): string {
	return `/work/view/${id}`;
}
export function workUrl(id: number): string[] {
	return [workHref(id), workAs(id)];
}

export function parse(path: string): string {
	const isWork = path.match(/\/work\/view\/(\d+)(.*?)$/);
	if (isWork) {
		return '/work/view?id=' + isWork[1] + (isWork[2] ? "&" + isWork[2] : "");
	}
	const isUser = path.match(/\/user\/(\d+)(.*?)$/);
	if (isUser) {
		return '/user/view?id=' + isUser[1] + (isUser[2] ? "&" + isUser[2] : "");
	}
	return path;
}